package com.springboot.common;

/**
 * 基于ThreadLocal封装的工具类，用户保存和获取当前登录用户信息
 */
public class BaseContext {
    private static final ThreadLocal<Long> threadLocal = new ThreadLocal<>();
    public static void  setUserId(Long userId){
        threadLocal.set(userId);
    }
    public static Long getUserId(){
        return threadLocal.get();
    }
}
